<!--# include virtual="/admin/common/html/header.html"-->
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-article-add" action="/guidance_service/front/policies/add.do">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>文章标题：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="titles" name="titles">
			</div>
		</div>
		<!--<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>文章摘要：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea id="abstract"  name="abstract" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="$.Huitextarealength(this,200)"></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/200</p>
			</div>
		</div>-->
		<!--<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>关键词：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="keyword" name="keyword">
			</div>
		</div>-->
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>文号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="source" name="source">
			</div>
		</div>	
		<!--<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>发文机关：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="authors" name="authors">
			</div>
		</div>	-->
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>发文机关：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box inline">
					<select name="authors"  id="authorsSelect" class="select" >
						<option value="0">全部分类</option>
						<option value="0">全部分类</option>
						<option value="0">全部分类</option>
					</select>
				</span>
			</div>
		</div>	
		<!--<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>发布日期：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'%y-%M-%d %h-%m-%s'})" id="commentdatemax" name="commentdatemax" class="input-text Wdate" value="">
			</div>
		</div>-->
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>时效性：：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box inline">
					<select name="authors"  id="authorsSelect" class="select" >
						<option value="现行有效">现行有效</option>
						<option value="已修改">已修改</option>
						<option value="已失效">已失效</option>
					</select>
				</span>
			</div>
		</div>	
		<!--<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>附件：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<div class="uploader-thum-container">
					<div id="fileList" class="uploader-list"></div>
					<div id="filePicker">选择附件</div>
					<button id="btn-star" class="btn btn-default btn-uploadstar radius ml-10">开始上传</button>
				</div>
			</div>
		</div>-->
		<div class="row cl" id="context_div" >
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>文章内容：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<script id="context" type="text/plain" style="width:100%;height:800px;"></script> 
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button onClick="article_save_submit();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交审核</button>
				<button onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>
	</form>
</article>
<!--# include virtual="/admin/common/html/_footer.html"-->
<script type="text/javascript">
window.UEDITOR_HOME_URL = window.location.port+'/admin/lib/ueditor/1.4.3/';
$(function(){
	var  policiesId= GetQueryString("policiesId");
    var  fieldId =GetQueryString("fieldId");
	$.post("/guidance_service/front/policies/get.do",{"policiesId":policiesId,"fieldId":fieldId},function(result){
		 if(result.resultCode == 200){
			$("input[name='titles']").val(result.data.titles);
			$("textarea[name='abstract']").val(result.data.abstract);
			$("input[name='keyword']").val(result.data.keyword);
			$("input[name='authors']").val(result.data.authors);					
			$("input[name='source']").val(result.data.source);	
			$("input[name='timeliness']").val(result.data.timeliness);
			$("#context").html(result.data.context);
			UE.getEditor('context');
 		}else{
 			layer.msg(result.message,{icon:2,time:2000},function(){
	 	    	window.history.back();
 			});
 		}
	});
});		
$(function(){		
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	$("#form-article-add").validate({		//表单验证
		rules:{
			titles:{
				required:true,
			},
			abstract:{
				required:true,
			},
			keyword:{
				required:true,
			},
			source:{
				required:true,				
			},
			authors:{
				required:true,
			},
			timeliness:{
				required:true,
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			var data =$(form).serialize();
			data.policiesId= GetQueryString("policiesId");
            data.fieldId =GetQueryString("fieldId");
			$.post("/guidance_service/front/policies/update.do",data,function(result){
		 		if(result.resultCode ==200){
		 			layer.msg(result.message,{icon:1,time:2000},function(){
		 				window.parent.location.href="/admin/modules/policy/article-list.html";
		 			});
		 		}else{
		 			layer.msg(result.message,{icon:2,time:2000});
		 		}
			});
		}
	});	
});
$(function(){
	$.post("/guidance_service/front/policies/authors/getAuthors.do",{},function(result){
		if(result.resultCode == 200){
			$.each(result.data,function(i,field){
				$("#authorsSelect").append("<option value='"+this.authorsName+"'>"+this.authorsName+"</option>");
			});
		}else{
			layer.msg(result.message,{icon:1,time:1000});
		}
	});
});
</script>
</body>
</html>
